<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML>
<html>
<head>
  <title>后台管理系统</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link href="/resources/css/dpl-min.css" rel="stylesheet" type="text/css" />
  <link href="/resources/css/bui-min.css" rel="stylesheet" type="text/css" />
  <link href="/resources/css/page-min.css" rel="stylesheet" type="text/css" />
  <link rel="stylesheet" type="text/css" href="/resources/js/editor/skins/default.css">
  <script language="JavaScript" src="/resources/js/editor/kindeditor.js"></script>
  <script language="JavaScript" src="/resources/js/editor/zh_CN.js"></script>
</head>
<body>

<div class="container">
  <form id="J_Form" class="form-horizontal" action="/order/import">

    <div class="row" id="img_tr" style="height: 150px;">
      <div class="control-group " style="width:100%;">
        <label class="control-label">请上传xlsx文件且文件格式为文本格式：

        <a href="javascript:window.open('/upload/template.xlsx','_blank')">模板下载</a>
        </label>
        <div class="controls" style="width:85%;">
          <input type="file"  id="innovationFile" /><br/>
          <span id="file"></span>
          <input type="hidden" name="fileName" id="fileName" />
        </div>
        <input type="hidden" name="images" id="images" value="${data.images}"/>
      </div>
    </div>



    <div class="row form-actions actions-bar">
      <div class="span13 offset3 ">
        <button type="submit" class="button button-primary">导入</button>
      </div>
    </div>
  </form>
</div>
<script type="text/javascript" src="/resources/js/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="/resources/js/bui-min.js"></script>
<script type="text/javascript" src="/resources/js/config-min.js"></script>
<script type="text/javascript" src="/resources/js/uploadReplace/uploadReplace.js"></script>

<script type="text/javascript">

  BUI.use('common/page'); //页面链接跳转
  BUI.use(['bui/tree','bui/form','bui/uploader'],function (Tree,Form,Uploader) {

    var form = new Form.HForm({
      srcNode : '#J_Form',
      submitType:"ajax",
      listeners:{
        beforesubmit:function(){
          return true;
        }
      },
      callback:function(data){
        BUI.Message.Alert(data.msg,function(){
          if(data.success){
           // back();
          }
        },'info');
      }
    });

    form.render();
  });

  function back(){
    top.topManager.openPage({
      id : 'import_list',
      isClose : true
    });
    top.topManager.reloadPage('import_list');
  }

  czyx.uploadReplace('#innovationFile',{
    url:'${request.getContextPath()}/upload/img?type=2&ran='+new Date().getTime(), //文件处理的URL
    uploadReplaceCss:{
      //设置上传按钮图片
      background:'url("${request.getContextPath()}/resources/js/uploadReplace/uploadbut1.png") center no-repeat',
      width:120,             //上传按钮的宽度
      height:36              //上传按钮的高度
    },
    uploadBefore:function(){
      this.style.display = 'none';
    },
    uploadEnd:function(serverJson){//上传完毕后调用
      this.style.display = 'block';
      var result=eval("("+serverJson+")");
      if(result.suc=="0"){
        this.style.display = 'block';
          /*var html="<div id='div_"+result.id+"' style='float:left;'><img src='${request.getContextPath()}"+result.url+"' id='img_"+result.id+"' style='width:100px;height:100px;'/>"+
                  "&nbsp;<div style='float:right;'><a class='fileDlt' style='cursor:pointer;'  onclick=\"deleteImg('"+result.id+"')\">删除</a><br/>" +
                  "<a class='fileDlt' style='cursor:pointer;'  onclick=\"upImg('"+result.id+"')\">上移</a><br/>" +
                  "<a class='fileDlt' style='cursor:pointer;'  onclick=\"downImg('"+result.id+"')\">下移</a></div>" +
                  "</div>";
          */
          $('#file').html(result.url);
          $("#fileName").val(result.url);
          $(".dform").addClass("dformAct");

      }
    }
  });


</script>

</body>
</html> 